package com.zsw.alancomicserver.repository.rowMapper;

import com.zsw.alancomicserver.repository.po.BookPO;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * book表与java对象映射
 */
public class BookRowMapper implements RowMapper<BookPO> {
    @Override
    public BookPO mapRow(ResultSet rs, int rowNum) throws SQLException {
        BookPO bookPO = new BookPO();

        bookPO.setId(rs.getLong("id"));
        bookPO.setBookId(rs.getLong("book_id"));
        bookPO.setBookImg(rs.getString("book_img"));
        bookPO.setBookName(rs.getString("book_name"));
        bookPO.setAuthor(rs.getString("author"));
        bookPO.setCreateTime(rs.getTimestamp("create_time"));
        bookPO.setUpdateTime(rs.getTimestamp("update_time"));
        return bookPO;
    }
}
